home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / UTILITY / DO1002.ARJ / INKEY.SCR < prev    next >
Text File  |  1991-12-13  |  1KB  |  42 lines

  1. .pg wi full clr cy
  2.     COMMAND NAME»gray«: »%t« InKey »ye«
  3.  
  4.     /INKEY [{key}] [{label}]
  5. /cw
  6.     »%t«InKey»#« tests to see if you have pressed a key and
  7.     returns that key in the variable »%t«CHAR»#«.  If »cy«{key}»#« is
  8.     specified then the key pressed must match that key otherwise
  9.     »ye«CHAR»#« is set to »re«NULL»#« ("").
  10.  
  11.     »%t«InKey»#« will jump to the specified »cy«{label}»#« if »cy«{key}»#« is »re«NULL»#« ("")
  12.     or the key pressed equals »cy«{key}»#«.
  13.  
  14. .pg
  15.     This feature is most often used in »gr«loops»#« where you wish to display
  16.     something or simply want to give the user a chance to abort the
  17.     loop. For example, the following code displays the time:
  18. »cy«
  19.         .clr
  20.         :Time
  21.         .go 1 1 reset
  22.         {time} Press <esc> to abort
  23.         »%t«/INKEY»ye« ~~»cy«027 End
  24.         .go 1 5
  25.         You pressed %%CHAR
  26.         /GOTO Time
  27.         :End
  28. »#«
  29.     Notice that we have used the »ye«tilde»#« notation to put in the decimal
  30.     equivalent for the »bo«<esc>»#« key.  Now we'll run this code for you:
  31.  
  32. .pg clr
  33. :Time
  34. »go 1 1 reset«{time} Press »bo«<esc>»#« to abort
  35. /INKEY ~027 End
  36. »go 1 5 reset«You pressed %CHAR
  37. /GOTO Time
  38. :End
  39. »go 1 7«The loop ended when you pressed »bo«<esc>»#«.
  40.  
  41. /ENDEXEC CLEAR
  42.